Function Inheritance: Monadic Memoization Mixins

نویسندگان

  • Daniel Brown
  • William R. Cook
چکیده

Inheritance is a mechanism for incrementally modifying recursive definitions. While inheritance is typically used in object-oriented languages, inheritance also has something to offer to functional programming. In this paper we illustrate the use of inheritance in a pure functional language by developing a small library for memoization. We define monadic memoization mixins that compose—via inheritance—with an ordinary monadic function to create a memoized version of the function. A comparison of the performance of different approaches shows that memoization mixins are efficient for a small example.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Monadic Memoization Mixins

Memoization is a familiar technique for improving the performance of programs: computed answers are saved so that they can be reused later instead of being recomputed. In a pure functional language, memoization of a function is complicated by the need to manage the table of saved answers between calls to the function, including recursive calls within the function itself. A lazy recursive data s...

متن کامل

Memoizing a Monadic Mixin DSL

Modular extensibility is a highly desirable property of a domain-specific language (DSL): the ability to add new features without affecting the implementation of existing features. Functional mixins (also known as open recursion) are highly suitable for this purpose. We study the use of mixins in Haskell for a modular DSL for search heuristics used in systematic solvers for combinatorial proble...

متن کامل

Types for Non-Standard Class Operations

Bracha and Cook illustrate how existing object-oriented languages with only single inheritance, such as Smalltalk and Beta, cannot describe extensions to a family of classes without duplicating either the extension or the base classes. To this end, they examine the idea of mixins from the Common Lisp Object System (CLOS) and show how to adapt the idea of mixins to other object-oriented systems ...

متن کامل

Nested Mixin-Methods in Agora

Mixin-based inheritance is an inheritance technique that has been shown to subsume a variety of different inheritance mechanisms. It is based directly upon an incremental modification model of inheritance. This paper addresses the question of how mixins can be seen as named attributes of classes the same way that objects, methods, and also classes in their own right, are seen as named attribute...

متن کامل

Object-based and class-based composition of transitive mixins

In object-oriented composition, classes and class inheritance are applied to realize type relationships and reusable building blocks. Unfortunately, these two goals might be contradictory in many situations, leading to classes and inheritance hierarchies that are hard to reuse. Some approaches exist to remedy this problem, such as mixins, aspects, roles, and meta-objects. However, in all these ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2009